﻿// ===============================================================================
// XCI.NET 西安交通信息WinForm开发框架 2018 版权所有
// ===============================================================================
using System;
using System.Net.Mail;

namespace XCI.Mail
{
    /// <summary>
    /// 邮件发送组件
    /// </summary>
    public interface IMail
    {
        /// <summary>
        /// 发送邮件
        /// </summary>
        /// <param name="recipients">收件人(多个逗号隔开)</param>
        /// <param name="subject">标题</param>
        /// <param name="body">正文</param>
        /// <returns>发送成功返回True</returns>
        bool Send(string recipients, string subject, string body);

        /// <summary>
        /// 发送邮件
        /// </summary>
        /// <param name="entity">邮件实体</param>
        /// <returns>发送成功返回True</returns>
        bool Send(MailMessage entity);

        /// <summary>
        /// 异步发送邮件
        /// </summary>
        /// <param name="recipients">收件人(多个逗号隔开)</param>
        /// <param name="subject">标题</param>
        /// <param name="body">正文</param>
        void SendAsync(string recipients, string subject, string body);

        /// <summary>
        /// 异步发送邮件
        /// </summary>
        /// <param name="entity">邮件实体</param>
        /// <param name="userToken">一个用户定义对象，此对象将被传递给完成异步操作时所调用的方法</param>
        /// <param name="sendCompletedCallback">在异步电子邮件发送操作完成时回调</param>
        void SendAsync(MailMessage entity, object userToken, Action<System.ComponentModel.AsyncCompletedEventArgs> sendCompletedCallback);
    }
}